﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class LoadingSceneForDll  {

    static GameObject _LoadingSceneController;
    static void Find()
    {
        if (_LoadingSceneController == null)
        {
            _LoadingSceneController = GameObject.Find("_LoadingSceneController");
            GameObject.DontDestroyOnLoad(_LoadingSceneController);
        }
    }

    public static void LoadSubContent()
    {
        Find();
        _LoadingSceneController.SendMessage("LoadSubContent");
    }

    public static void LoadDelectScene()
    {
        Find();
        _LoadingSceneController.SendMessage("LoadDelectScene");
    }

    /// <summary>
    /// 加载识别场景，并设置识别属性
    /// </summary>
    /// <param name="n_Type">要做那种识别</param>
    /// <param name="n_LineWidth"></param>
    /// <param name="c_LineColor">颜色四个数值范围0~255</param>
    public static void LoadDelectScenePra(int n_Type, int n_LineWidth, byte[] c_LineColor )
    {
        Find();
        if (c_LineColor != null)
        {
            object[] o_Para = new object[6] { n_Type, n_LineWidth, c_LineColor[0], c_LineColor[1], c_LineColor[2], c_LineColor[3] };
            _LoadingSceneController.SendMessage("LoadDelectScenePra", o_Para);
        }

        if (c_LineColor == null)
        {
            object[] o_Para = new object[2] { n_Type, n_LineWidth };
            _LoadingSceneController.SendMessage("LoadDelectScenePra", o_Para);
        }
        
    }

    public static void SetCurSceneName()
    {
        Find();
        _LoadingSceneController.SendMessage("SetCurSceneName");
    }
    public static void FromDelectSceneReturn()
    {
        Find();
        _LoadingSceneController.SendMessage("FromDelectSceneReturn");
    }

    public static void HistoryLoadScene(string sceneId)
    {
        Find();
        _LoadingSceneController.SendMessage("HistoryLoadScene",sceneId);
    }

    public static void LoadScene(string sceneId)
    {
        Find();
        _LoadingSceneController.SendMessage("LoadScene",sceneId);
    }

    public static void CollectionLoadScene(string sceneId)
    {
        Find();
        _LoadingSceneController.SendMessage("CollectionLoadScene",sceneId);
    }
}
